from sqlmodel import SQLModel, Field, Column, Integer, String, DateTime
from datetime import datetime


class UserKnowledgeBaseFile(SQLModel, table=True):
    __tablename__ = "user_knowledgebase_file"
    id: int = Field(default=None, primary_key=True)
    knowledgeBaseId: int = Field(
        sa_column=Column("knowledgebase_id", Integer, nullable=False),
        description="知识库id",
    )
    type: str = Field(
        sa_column=Column("type", String, nullable=False), description="文件类型"
    )
    fileName: str = Field(
        sa_column=Column("file_name", String, nullable=False),
        description="原始文件名",
    )
    alias: str = Field(
        sa_column=Column("alias", String, nullable=False),
        description="文件别名",
    )
    createTime: datetime = Field(
        sa_column=Column("create_time", DateTime, nullable=False),
        default_factory=datetime.now,
    )
